﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HelloMVC.Interface.Repository;
using HelloMVC.Model.highcharts;

namespace HelloMVC.Areas.DashBoard.Controllers
{
    public class ProjectController : Controller
    {
        #region vars
        private readonly IProjectRepository _projectRepository;
        #endregion

        public ProjectController(IProjectRepository projectRepository)
        {
            _projectRepository = projectRepository;
        }

        //
        // GET: /DashBoard/Project/
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id">Current Project Id</param>
        /// <returns></returns>
        [AcceptVerbs(HttpVerbs.Post)]
        public PartialViewResult AllProjects(Int32 id)
        {
            return PartialView("AllProjectsDrop", 
                _projectRepository.AllProjects().Where(m => m.Id != id).ToList());
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public PartialViewResult Summary()
        {
            return PartialView("Summary");
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public PartialViewResult Issues()
        {
            return PartialView("Issues");
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public JsonResult DataSet()
        {
            var dataSet = new DataSet();
            dataSet.categories = new List<String> {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
							"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
            dataSet.series = new List<Serie>();
            dataSet.series.Add(new Serie { name = "Tokyo", data = new List<float> { 7.0f, 6.9f, 9.5f, 14.5f, 18.2f, 21.5f, 25.2f, 0, 23.3f, 18.3f, 13.9f, 9.6f } });
            return Json(dataSet);
        }
    }
}
